<%@ page import="org.codehaus.groovy.grails.commons.ConfigurationHolder" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="author.create" default="Create Author" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home" /></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="author.list" default="Author List" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="author.create" default="Create Author" /></h1>
            <g:if test="${flash.message}">
	            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
            </g:if>
            <g:hasErrors bean="${authorInstance}">
	            <div class="errors">
	                <g:renderErrors bean="${authorInstance}" as="list" />
	            </div>
            </g:hasErrors>
            <g:form action="save" method="post" enctype="multipart/form-data">
                <div class="dialog">
                    <table>
                        <tbody>
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name"><g:message code="author.name" default="Name" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" value="${fieldValue(bean: authorInstance, field: 'name')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="lastname"><g:message code="author.lastName" default="Last Name" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'lastname', 'errors')}">
                                    <g:textField name="lastname" value="${fieldValue(bean: authorInstance, field: 'lastname')}" />
                                </td>
                            </tr>
                            
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="birdDay"><g:message code="author.birdDay" default="Bird Day" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'birdDay', 'errors')}">
                                    <g:datePicker name="birdDay" value="${authorInstance?.birdDay}" precision="day"/>
                                </td>
                            </tr>
                        	
                        	<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="male"><g:message code="author.gender" default="GENDER" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'gender', 'errors')}">
	                                <g:select from="${ConfigurationHolder.config.comics.gender}" name="gender" value="${authorInstance?.gender}" valueMessagePrefix="gender"/>
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description"><g:message code="author.description" default="Description" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'description', 'errors')}">
                                    <g:textArea name="description" value="${fieldValue(bean: authorInstance, field: 'description')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="country"><g:message code="author.country" default="Country" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'country', 'errors')}">
	                                <g:countrySelect name="country" default="esp" value="${fieldValue(authorInstance,field:'country')}"/>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                        		<td valign="top" class="name">
                        			<label><g:message code="author.path" default="AVATAR PATH" />:</label></td>
                        		<td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'path', 'errors')}">
                        			<input type="file" name="file"/>
                        		</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="rateable"><g:message code="author.rateable" default="RATEABLE" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'rateable', 'errors')}">
                                    <g:checkBox name="rateable" value="${authorInstance?.rateable}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="commentable"><g:message code="author.commentable" default="COMMENTABLE" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: authorInstance, field: 'commentable', 'errors')}">
                                    <g:checkBox name="commentable" value="${authorInstance?.commentable}" />
                                </td>
                            </tr>
                            
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'create', 'default': 'Create')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
